(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/Script/dogoer/DogoerFixMode_big.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, 'a2eaaV1FZRDqaDUmZAmExLQ', 'DogoerFixMode_big', __filename);
// Script/dogoer/DogoerFixMode_big.ts

Object.defineProperty(exports, "__esModule", { value: true });
var Constant_1 = require("../constant/Constant");
// Learn TypeScript:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/typescript.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var DogerFixed = /** @class */ (function (_super) {
    __extends(DogerFixed, _super);
    function DogerFixed() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.middleDog = null;
        _this.addScore = null;
        _this.leftObj = null;
        _this.rightObj = null;
        return _this;
    }
    // onLoad () {}
    DogerFixed.prototype.autoFixed = function (dogoer) {
        var totalW = this.leftObj.width + this.rightObj.width;
        var screenW = Constant_1.Constant.SCREEN.width;
        var length = dogoer.width = screenW - totalW;
        dogoer.getComponent(cc.BoxCollider).size.width = dogoer.width;
        dogoer.height = dogoer.getComponent(cc.BoxCollider).size.height;
        dogoer.x = 0;
    };
    DogerFixed.prototype.onLoad = function () {
    };
    DogerFixed.prototype.start = function () {
        this.middleDog = cc.find("bigDog", this.node);
        this.node.y = Constant_1.Constant.SCREEN.height / 2;
        this.autoFixed(this.middleDog);
        this.addScore.getComponent(cc.BoxCollider).size.width = Constant_1.Constant.SCREEN.width;
    };
    DogerFixed.prototype.update = function (dt) {
        this.movingPlaneBySpeed(dt);
    };
    DogerFixed.prototype.movingPlaneBySpeed = function (dt) {
        var t = this;
        var movingNode = t.node;
        if (movingNode.y < -Constant_1.Constant.SCREEN.height) {
            movingNode.y = Constant_1.Constant.SCREEN.height / 2;
            movingNode.active = false;
        }
        else {
            var action = cc.moveBy(dt, new cc.Vec2(0, -Constant_1.Constant.GAME_SPEED / 2));
            movingNode.runAction(action);
        }
    };
    __decorate([
        property(cc.Node)
    ], DogerFixed.prototype, "middleDog", void 0);
    __decorate([
        property(cc.Node)
    ], DogerFixed.prototype, "addScore", void 0);
    __decorate([
        property(cc.Node)
    ], DogerFixed.prototype, "leftObj", void 0);
    __decorate([
        property(cc.Node)
    ], DogerFixed.prototype, "rightObj", void 0);
    DogerFixed = __decorate([
        ccclass
    ], DogerFixed);
    return DogerFixed;
}(cc.Component));
exports.default = DogerFixed;

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=DogoerFixMode_big.js.map
        